package no.sogl.web;

import no.sogl.domain.PersonTag;

import org.springframework.core.convert.converter.Converter;
import org.springframework.format.FormatterRegistry;
import org.springframework.format.support.FormattingConversionServiceFactoryBean;
import org.springframework.roo.addon.web.mvc.controller.converter.RooConversionService;

/**
 * A central place to register application converters and formatters. 
 */
@RooConversionService
public class ApplicationConversionServiceFactoryBean extends FormattingConversionServiceFactoryBean {

	@Override
	protected void installFormatters(FormatterRegistry registry) {
		super.installFormatters(registry);
		// Register application converters and formatters
	}
	
	    public Converter<PersonTag, String> getPersonTagToStringConverter() {
	        return new org.springframework.core.convert.converter.Converter<no.sogl.domain.PersonTag, java.lang.String>() {
	            public String convert(PersonTag personTag) {
	                return new StringBuilder().append(personTag.getTag().getName()).toString();
	            }
	        };
	    }

}
